<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
if (window.internals)
  internals.settings.setEditingBehavior('win');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">|    abc    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-0 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre"> |   abc    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-1 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">  |  abc    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-2 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">   | abc    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    |abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-3 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    |abc    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-4 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    a|bc    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-5 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    ab|c    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-6 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc|    def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    אבצ    דדפ    hij    opq    </div>',
  '37-7 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc |   def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-8 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc  |  def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-9 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc   | def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-10 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    |def    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |\u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-11 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    d|ef    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |\u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-12 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    de|f    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |\u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-13 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def|    אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |\u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-14 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def |   אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |\u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-15 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def  |  אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |\u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-16 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def   | אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |\u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-17 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    |אבצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    |דדפ    hij    opq    </div>',
  '37-18 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    א|בצ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    |דדפ    hij    opq    </div>',
  '37-19 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אב|צ    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    |דדפ    hij    opq    </div>',
  '37-20 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ|    דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    |\u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-21 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ |   דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    |\u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-22 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ  |  דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    |\u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-23 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ   | דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    |\u05D3\u05D3\u05E4    hij    opq    </div>',
  '37-24 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    |דדפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    |hij    opq    </div>',
  '37-25 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    ד|דפ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    |hij    opq    </div>',
  '37-26 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דד|פ    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    |hij    opq    </div>',
  '37-27 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ|    hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    |hij    opq    </div>',
  '37-28 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ |   hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    |hij    opq    </div>',
  '37-29 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ  |  hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    |hij    opq    </div>',
  '37-30 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ   | hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    |hij    opq    </div>',
  '37-31 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    |hij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    |opq    </div>',
  '37-32 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    h|ij    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    |opq    </div>',
  '37-33 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hi|j    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    |opq    </div>',
  '37-34 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij|    opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    |opq    </div>',
  '37-35 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij |   opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    |opq    </div>',
  '37-36 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij  |  opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    |opq    </div>',
  '37-37 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij   | opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    |opq    </div>',
  '37-38 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    |opq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq|    </div>',
  '37-39 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    o|pq    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq|    </div>',
  '37-40 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    op|q    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    \u05D0\u05D1\u05E6    \u05D3\u05D3\u05E4    hij    opq|    </div>',
  '37-41 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq|    </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq    |</div>',
  '37-42 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq |   </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq    |</div>',
  '37-43 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq  |  </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq    |</div>',
  '37-44 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq   | </div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq    |</div>',
  '37-45 left word');

selection_test(
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq    |</div>',
  selection => selection.modify('move', 'left', 'word'),
  '<div contenteditable dir="rtl" style="white-space:pre">    abc    def    אבצ    דדפ    hij    opq    |</div>',
  '37-46 left word');
</script>
